package acm.蓝桥20;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;

/**
 * 如果质因子个数>3；gg n^2枚举质因子的倍数
 * 
 */
public class G分解质因子_还TM是数学题 {
	static PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	
	public static void main(String[] args) {
		Reader sc = new Reader();
		int t = sc.nextInt();
		while (t-- > 0) {
			boolean res = check(sc.nextLong());
			pw.println(res ? "yes" : "no");
		}
		pw.flush();
	}

	private static boolean check(long v) {
		long[] prime = new long[2];
		long origin=v;
		int cnt = 0;
		for (int i = 2; i <= v / i; i++) {
			if(cnt>=2)
				return false;
			if (v % i == 0) {
				prime[cnt++] = i;
				while (v % i == 0) {
					v /= i;
				}
			}
		}
		// 存在2个以上质因子
		if (cnt >= 2 && v > 1) {
			return false;
		}
		// 只有一个质因子
		if (cnt == 1 && v == 1) {
			return true;
		}
		int p1=(int) (Math.log(origin)/Math.log(prime[0]));
		int p2=(int) (Math.log(origin)/Math.log(prime[1]));
		
		for(int i=2;i<=p1;i++) {
			double cur=Math.pow(prime[0], i);
			for(int j=2;j<=p2;j++) {
				if(cur*Math.pow(prime[1], j)==origin) {
					return true;
				}
			}
		}
		return false;
	}
	static class Reader {
		static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
		static PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

		public Reader(Object... o) {
		}

		public int nextInt() {
			return (int) nextToken();
		}
		
		public long nextLong() {
			return (long) nextToken();
		}

		private double nextToken() {
			try {
				in.nextToken();
			} catch (Exception ignored) {
			}
			return in.nval;
		}
	}
}
